<template>
    <div>
        {{juelist}}
       

        <van-row>
            <Hearders />
            <van-col span="4">
                <Left />
            </van-col>

            <van-col span="4">
                <table border="1px" cellspaning='opx'>
                    <tr>
                        
                        <td>角色</td>
                        <td>操作</td>
                    </tr>
                    <tr v-for="i in juelist" :key="i.id">
                        
                        <td>{{i.name}}</td>
                        <td>
                            <button @click="add(i.resource,i.id)">添加权限</button>
                        </td>
                    </tr>
                </table>
                
            </van-col>

            <van-col span="16">

                    <Transfers @value='shou' />
            
                    
            </van-col>


            </van-row>



    </div>
</template>

<script>
import Hearders from '../comm/hearders'
import Left from '../comm/left.vue'
import Transfers from '../comm/transfers.vue'
import axios from '../../http/axios'
    export default {
        components: { Hearders ,Left,Transfers},
        data() {
            return {
                juelist:[],
                value:[]
            }
        },
        methods: {
            //获取所有角色
            get_jue(){
                axios('/users/getjue/','get').then(res=>{
                    this.juelist = res.list
                })
            },
            //接收穿梭框的值
            shou(value){
                this.value = value
            },
            //继承数据
            add(res,id){
                
                let datas = new FormData()
                datas.append("value",JSON.stringify(this.value))
                datas.append("resource",JSON.stringify(res))
                datas.append("jueid",id)
                
                axios('/users/getjue/','post',datas).then(res=>{
                    // alert(this.value,res,id)
                        
                })
            }
            
        },
        mounted() {
            this.get_jue()
        },
    }
</script>

<style scoped>

</style>